package org.javaweb.cms_web.controller;

import org.javaweb.cms_web.model.FeedbackDTO;
import org.javaweb.cms_web.mapper.FeedbackDTOMapper;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

//显示管理员回复
@Controller
public class ViewReplyController {

    @Autowired
    private FeedbackDTOMapper feedbackDTOMapper;

    @GetMapping("/ViewReplyController")
    public String viewReply(@RequestParam("feedbackId") int feedbackId, Model model) {
        System.out.println("显示管理员回复");
        System.out.println("feedbackId:" + feedbackId);

        // 根据 feedbackId 查询反馈详情
        FeedbackDTO feedbackDTO = feedbackDTOMapper.findById(feedbackId);

        System.out.println("feedback: " + feedbackDTO);
        // 将反馈数据添加到模型
        model.addAttribute("feedbackDTO", feedbackDTO);
        return "viewReply";
    }
}

